package com.atguigu.controller;

import com.atguigu.pojo.User;
import com.atguigu.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
@Tag(name="用户控制器")
public class UserController {
    @Autowired
    UserService userService;
    @GetMapping("/findAll")
    @Operation(summary = "查询所有用户的方法")
    public List<User> findAll(@Parameter(description = "用户的主键唯一标识") @RequestParam(name = "id", required = false) Integer id) {
        return userService.list();
    }
}
